//预览图片，删除并关闭
function showPicDel(o){
	var len = 0;
	var current_index = 0;
	var thumb;
		$(".showpic").remove();
		$(document.body).append("<div class=\"showpic animated zoomIn\"><ul></ul><div class=\"s-btn\"><img src=\"images/icon-return.png\" class=\"icoreturn btnl showpic_l\" /> <img src=\"\" class=\"icoreturn btnr showpic_r\" /></div><img src=\"\" class=\"icondel showpic_del\" /><img src=\"../c2.png\" class=\"icoreturn showpic_close\" /></div>");
		//绑定新的事件
		$(".showpic .showpic_l").unbind();
		$(".showpic .showpic_l").click(function(){
				$(".showpic ul li").removeClass("on");
				if(current_index==0){
					current_index = len-1;
				}else{
					current_index--;
				}	
				$(".showpic ul li").eq(current_index-1).addClass("on");	
		});
		$(".showpic .showpic_r").unbind();
		$(".showpic .showpic_r").click(function(){
				$(".showpic ul li").removeClass("on");	
				if(current_index < len-1){ current_index++;} else {current_index = 0;}
				$(".showpic ul li").eq(current_index).addClass("on");	
		});
		$(".showpic .showpic_del").unbind();
		$(".showpic .showpic_del").click(function(){
				var src = $(".showpic ul li").eq(current_index-1).find("img").attr("src");	
				$(".thumb-imgs").eq(current_index-1).parent().remove();
				//alert("此处添加删除事件"+src);
				//up_images.splice(current_index-1,1)
				$(".showpic").removeClass("on");
		});
		$(".showpic .showpic_close").unbind();
		$(".showpic .showpic_close").click(function(){
			$(".showpic").removeClass("on");
		});
	current_index  = $(o).index();	
	var shtml; 
	thumb = $(o).parent().find(".thumb-imgs");
	len   = thumb.length;
	$(".showpic ul li").remove();		
	for(var i =0; i < len;i++){
	   var srcs = $(thumb).eq(i).attr("src");
	   if(i==current_index-1){	      
	   		shtml ='<li class="on"><img src="'+srcs+'" alt=""/></li>';	
	   }else{
	   		shtml ='<li><img src="'+srcs+'" alt=""/></li>';	
	   }
	   $(".showpic ul").append(shtml);	    
    };	
	$(".showpic").addClass("on");
}

